<%@ page language="java" contentType="text/html;charset=UTF-8" %>
    <%@taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/struts-jquery-tags" prefix="sj" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="/passeport-animalier/css/main.css" rel="stylesheet" type="text/css"/>
<title><s:text name="espace.administrareur"/> </title>
	<sj:head jqueryui="true"  jquerytheme="flick" />
	<script type="text/javascript">
		function closeDialog(id){
			$('#'+id).dialog('close');
		}
		function nextButton(){
			$("#widget1").hide();
			$("#widget2").show();
		}
	</script>
</head>
<body>
	<jsp:include page="../layout/navigation_bar.jsp"/>
	<jsp:include page="../layout/header.jsp"/>
	
 	<div class="wrapper">
      <jsp:include page="../layout/menu.jsp"/>
        <div class="content">
		  <div class="title">
		    <h5> <s:text name="veterinaire.gestion_betail"/> </h5>
		  </div>
	    <div class="widget">
		  <div class="head">
		    <h5 class="iFrames"><s:text name="veterinaire.list_betails"/></h5>					
		  </div>
		  <div class="dataTables_wrapper" id="siteList_wrapper">
			<table cellspacing="0" cellpadding="0" border="0" id="siteList" class="display">
			  <thead>
			    <tr>
				  <th class="ui-state-default" rowspan="1" colspan="1" style="width: 30px;">
				    <div class="DataTables_sort_wrapper"> <s:text name="betail.id"/> </div>
				  </th>
				  <th class="ui-state-default" rowspan="1" colspan="1" style="width: 60px;">
					<div class="DataTables_sort_wrapper"> <s:text name="betail.sexe"/>  </div>
				  </th>
				  <th class="ui-state-default" rowspan="1" colspan="1" style="width: 100px;">
				    <div class="DataTables_sort_wrapper"> <s:text name="betail.dateNaissance"/> </div>
				  </th>
				  <th class="ui-state-default" rowspan="1" colspan="1" style="width: 80px;">
				    <div class="DataTables_sort_wrapper"><s:text name="betail.race"/></div>
				  </th>
				  <th class="ui-state-default" rowspan="1" colspan="1" style="width: 150px;">
					<div class="DataTables_sort_wrapper">Actions</div>
				  </th>
			    </tr>
			  </thead>
 			  <tbody>
				<s:iterator value="listBetails" status="status" var="b" >
				  <s:if test="#status.even">
				    <s:set name="cssClass" value="%{'gradeA even'}"/>
				  </s:if>
				  <s:else>
					<s:set name="cssClass" value="%{'gradeA odd'}"/>
				  </s:else>
				  <s:if test="#b.dateDece!=null">
					<s:set name="cssClass" value="%{'gradeA died'}"/>
				  </s:if>
				  <tr class="${cssClass}" id="tr${b.id}" >
					<td class=" sorting_1"> <s:property value="#b.id"/> </td>
					<td id="nom${b.id}"> <s:property value="#b.sexe"/> </td>
					<td id="prenom${b.id}"> <s:property value="#b.dateNaissance"/></td>
					<td id="typeBetail${b.id}"> <s:property value="#b.race.nom"/> </td>
					<td align="center">
				<!--  Modifier Betail   -->
					  <span class="icon"  >
					    <s:url  action="modifier_betail" namespace="/veterinaire" var="modifier_betail"> 
						  <s:param name="id" value="#b.id">  </s:param>
						</s:url>
						<sj:dialog id="modifier_betail%{#b.id}" href="%{modifier_betail}" title="%{#b.id}" 
						  autoOpen="false" width="600" height="600" draggable="true"
						   cssStyle="display:none;"
						  buttons="{
               			   		   'Save':function() { saveButton(); },
               					   'Cancel':function() { closeDialog('modifier_betail%{#b.id}'); }
                					}"
						 /> 
						<sj:a cssClass="btn14 mr5"  openDialog="modifier_betail%{#b.id}"> 
						   <img alt="" src="/passeport-animalier/images/icons/dark/cog2.png" title="modifier betail"> 
					    </sj:a>
			   		  </span>
			   		<!--  Prescrire une ordonnace   -->
			   		  <span class="icon"  >
					    <s:url  action="ajouter_ordonnance" namespace="/veterinaire" var="ajouter_ordonnance"> 
						  <s:param name="idBetail" value="#b.id">  </s:param>
						</s:url>
						<sj:dialog id="ajouter_ordonnance%{#b.id}" href="%{ajouter_ordonnance}" title="Préscrire une ordonnace" 
						  autoOpen="false" width="500" height="auto" draggable="true"
						   cssStyle="display:none;"
						  buttons="{
               			   		   'Next':function() { nextButton(); },
               					   'Cancel':function() { closeDialog('ajouter_ordonnance%{#b.id}'); }
                					}"
						 /> 
						<sj:a cssClass="btn14 mr5"  openDialog="ajouter_ordonnance%{#b.id}"> 
						   <img alt="" src="/passeport-animalier/images/icons/color/flask.png" title="modifier betail"> 
					    </sj:a>
			   		  </span>
			   	<!--  affichier toutes les info sur cette bétail   -->
			   		  <span class="icon">
					    <s:url  action="betail_info" namespace="/veterinaire" var="betail_info"> 
						  <s:param name="id" value="#b.id">  </s:param>
						</s:url>
						<sj:dialog id="betail_info%{#b.id}" href="%{betail_info}" title="%{#b.id}" 
						  autoOpen="false" width="600" height="600" draggable="true"
						  cssStyle="display:none;"
						  buttons="{
               			   		   'Save':function() { saveButton(); },
               					   'Cancel':function() { closeDialog('betail_info%{#b.id}'); }
                					}"
						 /> 
						<sj:a cssClass="btn14 mr5"  openDialog="betail_info%{#b.id}"> 
						   <img alt="" src="/passeport-animalier/images/icons/dark/info.png" title="modifier betail"> 
					    </sj:a>
			   		  </span>
					</td>
			      </tr>
				</s:iterator>
			  </tbody>
			</table>
		    <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix">
		      <div id="siteList_paginate" class="dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_full_numbers">
			<!--  Button First  -->
			   <s:url action="fistListBetail" namespace="/veterinaire" var="first"/>
			   <span id="siteList_last" class="toFirst ui-corner-tl ui-corner-bl fg-button ui-button "><s:a href="%{first}">First</s:a></span>
			<!--  	Button previous -->
			   <s:if test="page==1">
				 <span id="siteList_previous" class="previous fg-button ui-button ui-state-disabled">Prev</span>
			   </s:if>
			   <s:else>
			     <s:url action="prevtListBetail" namespace="/veterinaire" var="next">
				   <s:param name="page" value="%{page}"/>
				 </s:url>
				 <span id="siteList_previous" class="previous fg-button ui-button"><s:a href="%{next}">Prev</s:a></span>
			   </s:else>
			<!-- page/nbPages -->
			   <span>
			     <span class="fg-button ui-button ui-state-disabled"> <s:property value="page"/> / <s:property value="nbPages"/> </span>
			   </span>
			<!--  	Button Next -->
			   <s:if test="page < nbPages"  >
			     <s:url action="nextListBetail" namespace="/veterinaire" var="next">
				   <s:param name="page" value="%{page}"/>
				 </s:url>
				 <span id="siteList_next" class="next fg-button ui-button"> <s:a href="%{next}">Next</s:a> </span>
			   </s:if>
			   <s:else>
			     <span id="siteList_next" class="next fg-button ui-button ui-state-disabled"> Next </span>
			   </s:else>
			<!-- Button Last -->
			   <s:url action="lastListBetail" namespace="/veterinaire" var="last"/>
			   <span id="siteList_last" class="toFirst ui-corner-tl ui-corner-bl fg-button ui-button "><s:a href="%{last}">Last</s:a></span>
			  </div>
			</div>
	      </div>
		</div>
	  </div>
    </div>	
	<jsp:include page="../layout/footer.jsp"/>
</body>
</html>
